import http from "@/api";

// 获取设备列表
export const getDeviceList = (params: any) => {
  return http.post("/p/monitor/pub/v0/device/page", params);
};

// 获取报文列表
export const getDataPackageList = (params: any) => {
  return http.post("/p/monitor/pub/v0/dataPackage/page", params);
};
// 解码
export const decodeData = (params: any) => {
  return http.post("/p/monitor/pub/v0/dataPackage/decodeData", params);
};

// 获取上下线列表
export const getDeviceEventList = (params: any) => {
  return http.post("/p/monitor/pub/v0/deviceEvent/page", params);
};

// 校验规则分页查询
export const getCheckRuleList = (params: any) => {
  return http.post("/p/monitor/pub/v0/checkRule/page", params);
};

// 删除校验规则
export const deleteRule = (params: any) => {
  return http.post("/p/monitor/pub/v0/checkRule/delete", params);
};

// 删除校验规则
export const enableRule = (params: any) => {
  return http.post("/p/monitor/pub/v0/checkRule/enableState", params);
};

// 添加校验规则
export const addRule = (params: any) => {
  return http.post("/p/monitor/pub/v0/checkRule/add", params);
};

// 获取规则触发记录
export const getRuleRecord = (params: any) => {
  return http.post("/p/monitor/pub/v0/checkRuleEvent/page", params);
};

// 获取黑名单列表
export const getBlackList = (params: any) => {
  return http.post("/p/monitor/pub/v0/blackList/page", params);
};

// 删除黑名单
export const deleteBlackList = (params: any) => {
  return http.post("/p/monitor/pub/v0/blackList/delete", params);
};

// 添加或修改黑名单
export const addBlack = (params: any) => {
  return http.post("/p/monitor/pub/v0/blackList/addOrUpdate", params);
};

// 获取协议命令列表
export const getCmdList = (params: { protocolType?: string; cmd?: string }) => {
  return http.post("/p/monitor/pub/v0/protocolCmd/list", params);
};

// 获取上下线列表
export const getDeviceOnlineNumList = (params: { protocolType?: string; cmd?: string }) => {
  return http.post("/p/monitor/pub/v0/deviceOnlineNum/list", params);
};

// mock指令
export const cmdMockData = (params: { dataAll: string; deviceSn: string }) => {
  return http.post("/p/monitor/pub/v0/cmd/cmdMockDate", params);
};

// 协议指令列表
export const getCmdEnumList = () => {
  return http.post("/p/monitor/pub/v0/protocolCmd/list");
};

// 断线重连
export const deviceOffline = (params: { deviceSn: string }) => {
  return http.post("/p/monitor/pub/v0/device/deviceOffline", params);
};

// 校验规则列表
export const getAllRules = () => {
  return http.post("/p/monitor/pub/v0/checkRule/listAll");
};

// 获取离线在线数量
export const getOnlineAndOfflineNum = () => {
  return http.post("/p/monitor/pub/v0/statistic/onlineAndOfflineNum");
};

// 上下线次数排名
export const getDeviceOnlineNumRank = (params: { rankNum: number; startTime: number; endTime: number }) => {
  return http.post("/p/monitor/pub/v0/statistic/deviceOnlineNumRank", params);
};

export const getMockDataList = () => {
  return http.post("/p/monitor/pub/v0/mockData/list");
};

export const upMessage = (params: any) => {
  return http.post("/p/basic/pub/wx/v1/blueToothPiles/command", params);
};
